package org.softmed.rest.editor.uri;

import org.softmed.rest.editor.comps.browser.PagedList;

public class URIUtil {

	public static void decodeAmpersands(PagedList plist) {
		if (plist.getFirstURI() != null)
			plist.setFirstURI(decodeAmpersand(plist.getFirstURI()));

		if (plist.getPreviousURI() != null)
			plist.setPreviousURI(decodeAmpersand(plist.getPreviousURI()));

		if (plist.getNextURI() != null)
			plist.setNextURI(decodeAmpersand(plist.getNextURI()));

		if (plist.getLastURI() != null)
			plist.setLastURI(decodeAmpersand(plist.getLastURI()));

	}

	public static String decodeAmpersand(String url) {
		return url.replaceAll("&amp;", "&");
	}

}
